<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.org/ui">
    <head>
        <title>TODO supply a title</title>
    </head>
    <h:body> 
        <ui:composition  template="/resources/template/myTemplate.xhtml">
            <ui:define name="content">
                <c:set var="registered" scope="view" value="#{userManagedBean.registered}"/>
                <c:if test="${registered}">   
                    <h:form>      
                        <p:dataTable var="query" value="#{queriesManagedBean.queryList}" rowKey="#{query.id}"
                                     paginator="true" rows="10"
                                     selection="#{queriesManagedBean.query}" selectionMode="single">  
                            <f:facet name="header">  
                                My history  
                            </f:facet>  

                            <p:column headerText="Amount">  
                                #{query.amount}  
                            </p:column>  

                            <p:column headerText="Currency from">  
                                #{query.currencyFrom.shortName}  
                            </p:column>  

                            <p:column headerText="Currency to" >  
                                #{query.currencyTo.shortName}   
                            </p:column>  

                            <p:column headerText="Rate from">  
                                #{query.rateFrom}  
                            </p:column>  

                            <p:column headerText="Rate to">  
                                #{query.rateTo}  
                            </p:column>  

                            <p:column headerText="Closed Date">  
                                #{query.closedDate}  
                            </p:column>  

                            <p:column headerText="Status">  
                                #{query.status}  
                            </p:column>  
                        </p:dataTable> 
                    </h:form>
                </c:if>
                <c:if test="${!registered}">
                    Dear costumer you don`t have acces to this part of service. Please log-in or register.
                </c:if>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
